﻿#include <stdio.h>
#include <iostream>
#include "opencv2/opencv.hpp"
#include "opencv2/core/core.hpp"
using namespace cv;
using namespace std;
int main()
{
	Mat img_1 = imread("C:/opencv/picture/lena.jpg");
	if (img_1.empty())
		return 0;
	//缩小图片，1080p屏幕放不下
	Mat img;
	pyrDown(img_1, img);
	Mat hsv,rgbChannels[3], hsvChannels[3];
	//默认就是RGB。。。。。。
	split(img, rgbChannels);
	//转HSV然后split
	cvtColor(img, hsv, COLOR_BGR2HSV);
	split(hsv, hsvChannels);
	imshow("Origin", img_1);
	//总感觉直接用数组很危险！但是懒得写判断
	imshow("R", rgbChannels[0]);
	imshow("G", rgbChannels[1]);
	imshow("B", rgbChannels[2]);
	imshow("H", hsvChannels[0]);
	imshow("S", hsvChannels[1]);
	imshow("V", hsvChannels[2]);
	waitKey(0);
	return 0;
}